const express = require("express");

const router = express.Router();
const userInfoHandler = require("../router-handler/userinfo");

const expressJoi = require("@escook/express-joi");
const {
  update_userinfo_schema,
  update_password_schema,
  updata_avatar_schema,
} = require("../schema/user");

router.get("/userinfo", userInfoHandler.getUserInfo);
router.post(
  "/userinfo",
  expressJoi(update_userinfo_schema),
  userInfoHandler.updateUserInfo
);

router.post(
  "/updatepwd",
  expressJoi(update_password_schema),
  userInfoHandler.updatePassword
);

router.post(
  "/update/avatar",
  expressJoi(updata_avatar_schema),
  userInfoHandler.updateAvatar
);

module.exports = router;
